# Maintainer:
pkgname=mono
pkgver=6.12.0.205
pkgrel=1
pkgdesc="Free implementation of the .NET platform including runtime and compiler"
url="https://www.mono-project.com/"
arch="x86_64 aarch64"
license="MIT"
depends="python3"
depends_dev="
	$pkgname=$pkgver-r$pkgrel
	libgdiplus-dev
	"
makedepends="
	$depends_dev
	bash
	cmake
	linux-headers
	perl
	samurai
	"
subpackages="
	$pkgname-dev
	$pkgname-doc
	$pkgname-lang
	"
source="https://download.mono-project.com/sources/mono/preview/mono-$pkgver.tar.xz
	mono-try-catch.patch
	"
options="!check" # fail

build() {
	CFLAGS="$CFLAGS -O2 -flto=auto" \
	CXXFLAGS="$CXXFLAGS -O2 -flto=auto" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--disable-boehm \
		--enable-ninja \
		--disable-rpath \
		--disable-static \
		--enable-parallel-mark \
		--with-mcs-docs=no \
		--without-sigaltstack
	make
	make -C mcs/jay
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	make DESTDIR="$pkgdir" prefix=/usr INSTALL=../../install-sh -C mcs/jay install

	cd "$pkgdir"

	rm -rf \
		usr/lib/mono/*/Mono.Security.Win32* \
		usr/lib/*.la
}

dev() {
	default_dev

	mv "$subpkgdir"/usr/lib/*.so "$pkgdir"/usr/lib/
}

sha512sums="
ede22d511b8f0757b6ba3cb85af209eddfe9d19b00b0d870a8f6b68fa90bc56d3fe06a86874fdfcef2a1e93ec3ed524fee7d1363c0a00296c1d522bb8c71697a  mono-6.12.0.205.tar.xz
3a82d4bed31b212e23fe24647fc5b9c4788be5f4966377a3bef9f92a51d16181e77e19ca1ec4736792da6a18206986bbb54d967499e2ca7e224201cf811f91b5  mono-try-catch.patch
"
